<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>simReadForceSensor</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../../index.html" TARGET="_top"><img src="../images/homeImg.png"></a></p>

<h1><a href="../apiOverview.htm">Regular API</a> function</h1>
<h3 class=subsectionBar><a name="simReadForceSensor" id="simReadForceSensor"></a>simReadForceSensor / sim.readForceSensor</h3>
<table class=apiTable>
<tr class=apiTableTr> 
<td class=apiTableLeftDescr>
Description 
</td> 
<td class=apiTableRightDescr>Reads the force and torque applied to a force sensor (filtered values are read), and its current state ('unbroken' or 'broken'). See also <a href="simBreakForceSensor.htm">sim.breakForceSensor</a> and <a href="simGetJointForce.htm">sim.getJointForce</a>.<br></td>
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCSyn>
C synopsis
</td> 
<td class=apiTableRightCSyn>simInt simReadForceSensor(simInt objectHandle,simFloat* forceVector,simFloat* torqueVector)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCParam>C parameters</td> 
<td class=apiTableRightCParam>
<div><strong>objectHandle</strong>: handle of the object (must be a force sensor). Can be combined with <a href="../apiConstants.htm#specialHandleFlags">sim_handleflag_rawvalue</a> (simply add sim_handleflag_rawvalue to objectHandle), if you wish to access the raw values generated by each individual dynamic simulation step (by default, there are 10 dynamic simulation steps for each simulation step). Raw values can only be accessed from inside a <a href="../callbackFunctions.htm">callback function</a> triggered by the physics engine.</div>
<div><strong>forceVector</strong>: pointer to 3 values (applied forces along the sensor's x, y and z-axes). Can be nullptr</div>
<div><strong>torqueVector</strong>: pointer to 3 values (applied torques about the sensor's x, y and z-axes). Can be nullptr</div>
<div></div></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCRet>
C return value
</td> 
<td class=apiTableRightCRet>
<div>-1 in case of an error, otherwise bit-coded:</div>
<div class=tab>bit 0 set (1): force and torque data is available, otherwise it is not (yet) available (e.g. when not enough values are present for the filter)<br>
</div>
<div class=tab>bit 1 set (2): force sensor is broken, otherwise it is still intact ('unbroken')<br>
</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLSyn>
Lua synopsis
</td> 
<td class=apiTableRightLSyn>number result, table_3 forceVector,table_3 torqueVector=sim.readForceSensor(number objectHandle)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLParam>Lua parameters</td> 
<td class=apiTableRightLParam>
<div>Similar to the C-function counterpart</div>
<div></div></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLRet>
Lua return values
</td> 
<td class=apiTableRightLRet>
<div><strong>result</strong>: bit-coded (same as for the C-function return value)</div>
<div><strong>forceVector</strong>: table holding 3 values (applied forces along the sensor's x, y and z-axes)</div>
<div><strong>torqueVector</strong>: table holding 3 values (applied torques about the sensor's x, y and z-axes)</div>
</td> 
</tr> 

<tr class=apiTableTr> 
<td class=remApiTableLeftCParam>
Remote API equiv.
</td> 
<td class=remApiTableRightCParam>
<div>B0-based remote API: <a href="../b0RemoteApi-cpp.htm#simxReadForceSensor">simxReadForceSensor</a></div>
<div>Legacy remote API: <a href="../remoteApiFunctions.htm#simxReadForceSensor">simxReadForceSensor</a></div>
</td> 
</tr> 

</table> 

<br>
<p><a href="../apiFunctions.htm">All regular API functions on one page</a></p>
<br>
<br>
</td>
</tr>
</table>
</div>
</body>
</html>
